<?php
/**
 * ResMania
 * More Information contact: info@resmania.com
 *
 * @package Core Framework Installation Helper Page HTML
 * @version 0.5
 * @author webformatique
 * @copyright (C) 2010- webformatique
 * @license GNU/GPLv3 http://www.gnu.org/copyleft/gpl.html
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

?>

<script type="text/javascript">
    var JPath = '<?php echo $JoomlaPath;?>';
    var sid = '<? echo uniqid();?>'
</script>

<!-- Jquery is required because the version of mootools in Joomla does not support Request.JSON -->
<script type="text/javascript" src="<?php echo $JoomlaPath;?>components/com_resmania/installation/libs/js/jquery.js"></script>
<script type="text/javascript" src="<?php echo $JoomlaPath;?>components/com_resmania/installation/libs/js/ui.core.js"></script>
<script type="text/javascript" src="<?php echo $JoomlaPath;?>components/com_resmania/installation/libs/js/ui.progressbar.js"></script>
<script type="text/javascript" src="<?php echo $JoomlaPath;?>components/com_resmania/installation/libs/js/jqdialog.min.js"></script>
<link type="text/css" href="<?php echo $JoomlaPath;?>components/com_resmania/installation/libs/js/progressbar.css" rel="stylesheet" />

<style type="text/css">
        .ui-progressbar-value { background-image: url(<?php echo $JoomlaPath;?>components/com_resmania/installation/images/pbar-ani.gif); }
</style>

<link type="text/css" href="<?php echo $JoomlaPath;?>components/com_resmania/installation/view/tmpl/install.css" rel="stylesheet" />

<div class="RMLOGO2"><span class="RMLOGO1">Res</span>Mania Core Framework installation<span class="RMVERSION">Installer Version: <?php echo $installer_version;?></span></div>

<form method="POST" action="index.php?option=com_resmania&act=install" id="installform">
<input type="hidden" id="stableversion" value="">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="top"><img name="step1" src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/step1.gif" width="32" height="32" alt="Step One"></td>
    <td width="50%" valign="top">
        <table width="100%" border="0" cellspacing="0" cellpadding="5">
        <tr>
          <td width="300"><p class="stepheading">Pre-requisite Checks</p></td>
          <td width="50"><a href="#" class="tooltip" onclick='hideshow("#precheckssection");'><img src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/tickexpand.gif"  alt=""><span><div id="click_to_expand_msg1"></div></span></a></td>
          <td width="50">&nbsp;</td>
        </tr>
        </table>
        <div id="precheckssection">
            <table width="100%" border="0" cellspacing="0" cellpadding="5">
            <tr>
              <td width="300"><img class="RMBULLET" src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/bullet.gif">&nbsp;Log writable (using fopen)</td>
              <td width="50"><div id="logchkdiv"><!--php status icon here--></div></td>
              <td width="50"><a href="#" class="tooltip"><img src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/info.gif" alt="Ok" name="Ok" width="20" height="20" id="Ok"><span><div id="log_help"></div></span></a></td>
            </tr>
            <tr>
              <td width="300"><img class="RMBULLET" src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/bullet.gif">&nbsp;PHP Version Check (>5.2.5)</td>
              <td width="50"><div id="phpchkdiv"><!--php status icon here--></div></td>
              <td width="50"><a href="#" class="tooltip"><img src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/info.gif" alt="Ok" name="Ok" width="20" height="20" id="Ok"><span><div id="php_help"></div></span></a></td>
            </tr>
            <tr>
              <td width="300"><img class="RMBULLET" src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/bullet.gif">&nbsp;PHP Configuration</td>
              <td width="50"><div id="phpconfigchkdiv"><!--php config check status icon here--></div></td>
              <td width="50"><a href="#" class="tooltip"><img src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/info.gif" alt="Ok" name="Ok" width="20" height="20" id="Ok"><span><div id="phpconfig_help"></div></span></a></td>
            </tr>
            <tr>
              <td width="300"><img class="RMBULLET" src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/bullet.gif">&nbsp;Core Folder Check </td>
              <td width="50"><div id="folderchkdiv"><!--folder status icon here--></div></td>
              <td width="50"><a href="#" class="tooltip"><img src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/info.gif" alt="Ok" name="Ok" width="20" height="20" id="Ok"><span><div id="folder_help"></div></span></a></td>
            </tr>
            <tr>
              <td width="300"><img class="RMBULLET" src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/bullet.gif">&nbsp;MySQL InnoDB Check </td>
              <td width="50"><div id="dbchkdiv"><!--db check status icon here--></div></td>
              <td width="50"><a href="#" class="tooltip"><img src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/info.gif" alt="Ok" name="Ok" width="20" height="20" id="Ok"><span><div id="db_help"></div></span></a></td>
            </tr>
            <tr>
              <td width="300"><img class="RMBULLET" src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/bullet.gif">&nbsp;Zend Framework Check </td>
              <td width="50"><div id="zf_check_div"><!--loader check status icon here--></div></td>
              <td width="50"><a href="#" class="tooltip"><img src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/info.gif" alt="Ok" name="Ok" width="20" height="20" id="Ok"><span><div id="zf_help"></div></span></a></td>
            </tr>
            <tr>
              <td width="300"><img class="RMBULLET" src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/bullet.gif">&nbsp;Destination File Size Check</td>
              <td width="50"><div id="destinsize_div"><!--loader check status icon here--></div></td>
              <td width="50"><a href="#" class="tooltip"><img src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/info.gif" alt="Ok" name="Ok" width="20" height="20" id="Ok"><span><div id="destinsize_help"></div></span></a></td>
            </tr>
            </table>
        </div>
    </td>
    <td width="50%" rowspan="3" valign="top">
	<p><strong>This is the ResMania Installer.</strong></p>
	<p><strong>This  will install the ResMania Core Framework (required to run ResMania). This framework is external to Joomla! and is downloaded to your website during the installation process. </strong></p>
	<hr>
        <div id="versionselectionblock" style="display:none;">
            <h2>Select Core Version to Install</h2>
            <div id="versionsection">
                <select id="version" name="version" onChange="betaSelectionWarning(this.value);">
                    <!-- versions are added her dynmically -->
                </select>
            </div>
            <hr>
        </div>
        <h2>Problems Installing?</h2>
        <div id="helpsection">
            <div align="left"><b>Don't worry there's help at hand!</b>
                 <ul>
                      <li><a href="http://docs.resmania.com/index.php?title=Joomla_Installation_Guide" target="_blank">Joomla Installation Guide</a></li>
                      <li><a href="http://docs.resmania.com/index.php?title=Trouble_Shooting_Guides" target="_blank">Installation Troubleshooting Guide</a></li>
                      <li><a href="http://docs.resmania.com/index.php?title=ResMania_User_Guide" target="_blank">ResMania User Guide</a></li>
                      <li><a href="http://forum.resmania.com" target="_blank">ResMania Forum</a></li>
                      <li><a href="<?php echo $JoomlaPath;?>components/com_resmania/installation/install.log" target="_blank">Installation Log</a></li>
                </ul>
            </div>
            <p align="left">(all links open a new window)</p>
        </div>
	<p class="abouttext"></p>
    </td>
  </tr>
  <tr>
    <td width="50" valign="top">
        <div id="step_2_icon" style="display:none;">
            <img src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/step2.gif" alt="Step Two" name="step2" width="32" height="32" id="step2">
        </div>
    </td>
    <td width="50%" valign="top">
      <div id="step_2" style="display:none;">
          <table width="100%" border="0" cellspacing="0" cellpadding="5">
        <tr>
          <td width="300"><p class="stepheading">Installation Options</p></td>
          <td width="50"><a href="#" class="tooltip" onclick='hideshow("#optionssection");'><img src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/tickexpand.gif" alt=""><span><div id="click_to_expand_msg2"></div></span></a></td>
          <td width="50">&nbsp;</td>
        </tr>
        </table>
          <div id="optionssection">
              <table width="100%" border="0" cellspacing="0" cellpadding="5">
                <tr>
                  <td width="300"><div id="messagediv"><!-- installation messages here--></div></td>
                  <td width="50"><div id="overwritecheckbox"><!-- the overwrite confirmation checkbox will be rendered here--></div></td>
                  <td width="50"><a href="#" class="tooltip"><img src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/info.gif" alt="Ok" name="Ok" width="20" height="20" id="Ok"><span><div id="core_reload_help"></div></span></a></td>
                </tr>
                <tr>
                  <td width="300"><div id="dbmessagediv"><!-- db installation messages here--></div><br /></td>
                  <td width="50"><div id="dboverwritecheckbox"><!-- the db options will be rendered here--></div></td>
                  <td width="50"><a href="#" class="tooltip"><img src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/info.gif" alt="Ok" name="Ok" width="20" height="20" id="Ok"><span><div id="db_reset_help"></div></span></a></td>
                </tr>
              </table>
          </div>
      </div>
        <div id="resumeenabled" style="display:none;">
        <table width="100%" border="0" cellspacing="0" cellpadding="5">
            <tr>
              <td width="300">Do Not Resume Core Download</td>
              <td width="50"><input type="checkbox" value="1" id="resumedownload" ></td>
              <td width="50"><a href="#" class="tooltip"><img src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/info.gif" alt="Ok" name="Ok" width="20" height="20" id="Ok"><span><div id="resume_help"></div></span></a></td>
            </tr>
        </table>
        </div>
      <div align="center"><div id="nextbuttondivmsg"><!-- next button message here--></div><br /><div id="nextbuttondiv"><!-- next button here--></div></td>
	</tr>
  <tr>
    <td valign="top">
        <div id="step_3_2icon" style="display:none;">
            <img src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/step2.gif" alt="Step Two" name="step2" width="32" height="32" id="step2">
        </div>
        <div id="step_3_3icon" style="display:none;">
            <img src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/step3.gif" alt="Step Three" name="step3" width="32" height="32" id="step2">
        </div>
    </td>
    <td valign="top">
	<!-- second phase steps -->
        <div id="step_3" style="display:none;">
        <p class="stepheading">Core Framework and Database Setup</p>
          <table width="100%" border="0" cellspacing="0" cellpadding="5">
            <tr>
              <td width="300"><img src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/bullet.gif" alt="4" class="RMBULLET">&nbsp;Core Framework Download </td>
              <td width="50">
                  <div id="downloadstatus"><!--download status icon here--></div>
                  <div id="progressbar"></div>
              </td>
              <td width="50">
                  <a href="#" class="tooltip"><img src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/info.gif" alt="Ok" name="Ok" width="20" height="20" id="Ok"><span><div id="download_help"></div></span></a>
              </td>
            </tr>
            <tr>
              <td width="300"><img src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/bullet.gif" alt="3" class="RMBULLET">&nbsp;Core Framework Installation </td>
              <td width="50"><div id="unzipcore">
                <!--unzip status icon here-->
              </div></td>
              <td width="50">
                  <a href="#" class="tooltip"><img src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/info.gif" alt="Ok" name="Ok" width="20" height="20" id="Ok"><span><div id="unzip_help"></div></span></a>
              </td>
            </tr>
            <tr>
              <td width="300"><img src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/bullet.gif" alt="2" class="RMBULLET">&nbsp;Database Installation </td>
              <td width="50"><div id="dbsetup">
                <!--db setup status icon here-->
              </div></td>
              <td width="50">
                  <a href="#" class="tooltip"><img src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/info.gif" alt="Ok" name="Ok" width="20" height="20" id="Ok"><span><div id="dbsetup_help"></div></span></a>
              </td>
            </tr>
            <tr>
              <td width="300"><img src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/bullet.gif" alt="1" class="RMBULLET">&nbsp;Installation Check</td>
              <td width="50"><div id="installcheck">
                <!--install check status icon here-->
              </div></td>
              <td width="50">
                  <a href="#" class="tooltip"><img src="<?php echo $JoomlaPath;?>components/com_resmania/installation/images/info.gif" alt="Ok" name="Ok" width="20" height="20" id="Ok"><span><div id="check_help"></div></span></a>
              </td>
            </tr>
          </table>
        </div>
        <div align="center"><div id="textpleasewait"></div></div>
        <br />
        <div align="center"><div id="textcomplete"></div></div>
    </td>
</tr>
</table>
</form>

<script type="text/javascript">
<?php
if ($Is16) {
    echo 'var RM_URL = "index.php?option=com_resmania&format=row";';
} elseif ($Is15) {
    echo 'var RM_URL = "index3.php?option=com_resmania";';
}
?>
</script>
<script type="text/javascript" src="<?php echo $JoomlaPath;?>components/com_resmania/installation/view/tmpl/install.js"></script>
<script type="text/javascript">
    /**
     * This script provides window.online for all browsers. Window.online works
     * fine on most browsers apart from MSIE so we have to use this. This Code
     * is based on the code found here http://dean.edwards.name/weblog/2006/06/again/
     * by Dean Edwards/Matthias Miller/John Resig
     */
    function init() {
        if (arguments.callee.done) return; // quit if this function has already been called
        arguments.callee.done = true; // flag this function so we don't do the same thing twice

        if (_timer) clearInterval(_timer); // kill the timer

        checkit(); // run checkit function
    };

    /* for Mozilla/Opera9 */
    if (document.addEventListener) {
        document.addEventListener("DOMContentLoaded", init, false);
    }

    /* for Internet Explorer */
    /*@cc_on @*/
    /*@if (@_win32)
      document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
      var script = document.getElementById("__ie_onload");
      script.onreadystatechange = function() {
        if (this.readyState == "complete") {
          init(); // call the onload handler
        }
      };
    /*@end @*/

    /* for Safari */
    if (/WebKit/i.test(navigator.userAgent)) { // sniff
        var _timer = setInterval(function() {
            if (/loaded|complete/.test(document.readyState)) {
                init(); // call the onload handler
            }
        }, 10);
    }

    /* for other browsers */
    window.onload = init;

</script>